﻿<phone:PhoneApplicationPage 
    x:Class="IPMsgMoTest.ChatPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    d:DataContext="{d:DesignData SampleData/ChatViewDesignData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    toolkit:TiltEffect.IsTiltEnabled="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot Title="正在聊天">
            <controls:Pivot.Background>
                <ImageBrush ImageSource="ChatViewBackground.png"/>
            </controls:Pivot.Background>
            <!--Pivot item one-->
            <controls:PivotItem Header="{Binding Hostname}">
                <ListBox Margin="0,0,-12,0" Height="400" ItemsSource="{Binding ChatItems}" VerticalAlignment="Top">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Margin="0,0,0,17"  Width="450">
                                <StackPanel Width="400"  HorizontalAlignment="{Binding Halign}"  Background="{Binding BackColor}">
                                    <TextBlock Text="{Binding TimeStamp}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSmallStyle}"/>
                                    <TextBlock Text="{Binding ChatContent}" TextWrapping="Wrap" Margin="12,0" Style="{StaticResource PhoneTextLargeStyle}" FontSize="24" />
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>
        </controls:Pivot>
        <TextBox Height="120" HorizontalAlignment="Left" Margin="12,576,0,0" Name="textBlockContent" VerticalAlignment="Top" Width="456" />
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_btnSend" IconUri="/Image/Icon/appbar.feature.email.rest.png" Text="发送" Click="appbar_btnSend_Click" />
            <shell:ApplicationBarIconButton x:Name="appbar_btnClear" IconUri="/Image/Icon/appbar.delete.rest.png" Text="清空记录" Click="appbar_btnClear_Click" />
            <shell:ApplicationBarIconButton x:Name="appbar_btnClose" IconUri="/Image/Icon/appbar.close.rest.png" Text="关闭" Click="appbar_btnClose_Click" />
            <!--<shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>